import axios from 'axios'
import tooler from './tooler'

let instance;
init();

function init(){
    var host = tooler.readData("host", "");
    changeHost(host);
}

function changeHost(data){
    instance = axios.create({
        baseURL: data
    })
}

function get(url, params){
    return instance.get(url, {
        params: params
    })
}

function post(url, params){
    return instance.post(url, params);
}

export default {
    get,
    post,
    changeHost
}